package com.caiyi.financial.nirvana.sms.controller;

import com.caiyi.financial.nirvana.sms.entity.SmsGatewayTemplate;
import com.caiyi.financial.nirvana.sms.querybean.GatewayTemplateQueryBean;
import com.caiyi.financial.nirvana.sms.service.SmsGatewayTemplateService;
import com.youyu.common.api.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(description = "通道模板管理")
@RestController
@RequestMapping("sms/admin/gatewayTemplate")
public class GatewayTemplateController {

    @Autowired
    private SmsGatewayTemplateService gatewayTemplateService;

    @ApiOperation(value = "添加GatewayTemplate详情", notes = "添加GatewayTemplate详情描述")
    @ApiImplicitParam(name = "smsGatewayTemplate", value = "通道模板", required = true, dataType = "SmsGatewayTemplate")
    @PostMapping("/addGatewayTemplate")
    public Result addGatewayTemplate(@RequestBody SmsGatewayTemplate smsGatewayTemplate) {
        return Result.ok(gatewayTemplateService.addGatewayTemplate(smsGatewayTemplate));
    }

    @ApiOperation(value = "删除GatewayTemplate详情", notes = "删除GatewayTemplate")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "通道模板id", dataType = "int", paramType = "query", required = true)})
    @PostMapping("/deleteGatewayTemplate")
    public Result deleteGatewayTemplate(Integer id) {
        return Result.ok(gatewayTemplateService.deleteGatewayTemplate(id));
    }

    @ApiOperation(value = "更新GatewayTemplate详情", notes = "更新GatewayTemplate")
    @ApiImplicitParam(name = "smsGatewayTemplate", value = "通道模板", required = true, dataType = "SmsGatewayTemplate")
    @PostMapping("/updateGatewayTemplate")
    public Result updateGatewayTemplate(@RequestBody SmsGatewayTemplate smsGatewayTemplate) {
        return Result.ok(gatewayTemplateService.updateGatewayTemplate(smsGatewayTemplate));
    }


    @ApiOperation(value = "根据params查找GatewayTemplate详情", notes = "根据params查找GatewayTemplate详情描述")
    @ApiImplicitParams({@ApiImplicitParam(name = "bean", value = "查找通道模板参数", dataType = "GatewayTemplateQueryBean", paramType = "GatewayTemplateQueryBean"),

    })
    @PostMapping("/getGatewayTemplateByParams")
    public Result getGatewayTemplateByParams(@RequestBody GatewayTemplateQueryBean bean) {
        return Result.ok(gatewayTemplateService.getGatewayTemplateByParams(bean));
    } 


}
